home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / c_course.zip / TEMPCONV.C < prev    next >
Text File  |  1989-12-30  |  1KB  |  30 lines

  1. /****************************************************************/
  2. /*                                                              */
  3. /*     This is a temperature conversion program written in      */
  4. /*      the C programming language. This program generates      */
  5. /*      and displays a table of farenheit and centigrade        */
  6. /*      temperatures, and lists the freezing and boiling        */
  7. /*      of water.                                               */
  8. /*                                                              */
  9. /****************************************************************/
  10.  
  11. main()
  12. {
  13. int count;        /* a loop control variable               */
  14. int farenheit;    /* the temperature in farenheit degrees  */
  15. int centigrade;   /* the temperature in centigrade degrees */
  16.  
  17.    printf("Centigrade to Farenheit temperature table\n\n");
  18.  
  19.    for(count = -2;count <= 12;count = count + 1){
  20.       centigrade = 10 * count;
  21.       farenheit = 32 + (centigrade * 9)/5;
  22.       printf("  C =%4d   F =%4d  ",centigrade,farenheit);
  23.       if (centigrade == 0)
  24.          printf(" Freezing point of water");
  25.       if (centigrade == 100)
  26.          printf(" Boiling point of water");
  27.       printf("\n");
  28.    } /* end of for loop */
  29. }
  30.